function [projDir] = project_horizontal_space(eta,model)
% This defines the projection 
% form the Euclidean space: R^{n \times p}\times R^{p \times p} \times R^{m \times p}
% to the horizontal space
%
% Authors:
% Bamdev Mishra and Gilles Meyer
% {b.mishra,g.meyer}@ulg.ac.be



%% Projection from the Euclidean space to the Tangent space of the Total space

eta.U = proj_tangent_space_stiefel(eta.U,model.U);
eta.V = proj_tangent_space_stiefel(eta.V,model.V);
eta.B = eta.B; % Not needed

%% Projection from the Tangent space to the Horizontal space
SS = model.B*model.B;
AS = model.B*(skew(model.U'*eta.U) + skew(model.V'*eta.V) - 2*skew(model.B\eta.B))*model.B;
omega = sylvester1(SS,AS);

projDir.U = eta.U - model.U*omega;
projDir.B = symm(eta.B) - (model.B*omega - omega*model.B);
projDir.V = eta.V - model.V*omega;
      